//
//  APIEnergyFootManager.m
//  cocoapodText
//
//  Created by apple on 16/10/18.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "NetTool.h"
#import "AFNetworking.h"
#import "APIEnergyFootManager.h"

@interface APIEnergyFootManager()

@end
@implementation APIEnergyFootManager

/**
 *@name 节能足迹
 *@param action showChart
 *@param esCode=01 备注：esCode传送电水冷编码 电：01，水：02 冷 05
 *@param orgNo=520100000
 *@param year=2016
 *@param jnjpbs=2：类型 1：节能量 2：减排量
 *@param orgId 区域时格式为：id:name:00 如："520100000:4: 贵阳市 :00"
 */
-(void)fsgy_api_info_foot_withFalg:(NSString *)falg esCode:(NSString *)esCode orgNo:(NSString *)orgNo year:(NSString *)year jnjpbs:(NSString *)jnjpbs orgId:(NSString *)orgId{

    AFHTTPSessionManager *session = [AFHTTPSessionManager manager];
    //申明返回的结果是json类型
    session.responseSerializer = [AFJSONResponseSerializer serializer];
    //如果报接受类型不一致请替换一致text/html或别的
    session.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/plain"];
    NSString *neturl=[NetTool fsgy_info_energy_foot];
    NSDictionary *params=@{@"action":@"showChart",@"esCode":esCode,@"orgNo":orgNo,@"year":year,@"jnjpbs":jnjpbs,@"orgId":orgId};
    [session GET:neturl parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
        if([_delegate respondsToSelector:@selector(onEnergyFootManager:result:Flag:)]){
            [_delegate onEnergyFootManager:self result:responseObject Flag:falg];
        }
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        [CommonTool isSessionExpired:task];
    }];
}
- (void)fsgy_api_info_foot_area_withFalg:(NSString *)falg esCode:(NSString *)esCode orgNo:(NSString *)orgNo structType:(NSString *)structType orgId:(NSString *)orgId{
    AFHTTPSessionManager *session = [AFHTTPSessionManager manager];
    //申明返回的结果是json类型
    session.responseSerializer = [AFJSONResponseSerializer serializer];
    //如果报接受类型不一致请替换一致text/html或别的
    session.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/plain"];
    NSString *neturl=[NetTool fsgy_info_energy_foot_area];
    NSDictionary *params=@{@"action":@"showTree",@"esCode":esCode,@"orgNo":orgNo,@"structType":structType,@"orgId":orgId};
    [session GET:neturl parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
        if([_delegate respondsToSelector:@selector(onEnergyFootManager:result:Flag:)]){
            [_delegate onEnergyFootManager:self result:responseObject Flag:falg];
        }
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        [CommonTool isSessionExpired:task];
    }];

}

@end
